<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    1002. Maximum Width Ramp
   </h1>
   <p>
    Given an array
    <code>
     A
    </code>
    of integers, a
    <em>
     ramp
    </em>
    &nbsp;is a tuple
    <code>
     (i, j)
    </code>
    for which
    <code>
     i &lt; j
    </code>
    &nbsp;and&nbsp;
    <code>
     A[i] &lt;= A[j]
    </code>
    .&nbsp; The width of such a&nbsp;ramp is
    <code>
     j - i
    </code>
    .
   </p>
   <p>
    Find the maximum width of a ramp in
    <code>
     A
    </code>
    .&nbsp; If one doesn't exist, return 0.
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input: </strong><span id="example-input-1-1">[6,0,8,2,1,5]</span>
<strong>Output: </strong><span id="example-output-1">4</span>
<strong>Explanation: </strong>
The maximum width ramp is achieved at (i, j) = (1, 5): A[1] = 0 and A[5] = 5.
</pre>
   <div>
    <p>
     <strong>
      Example 2:
     </strong>
    </p>
    <pre>
<strong>Input: </strong><span id="example-input-2-1">[9,8,1,0,1,9,4,0,4,1]</span>
<strong>Output: </strong><span id="example-output-2">7</span>
<strong>Explanation: </strong>
The maximum width ramp is achieved at (i, j) = (2, 9): A[2] = 1 and A[9] = 1.
</pre>
   </div>
   <div>
    <div>
     <p>
      &nbsp;
     </p>
     <p>
      <strong>
       Note:
      </strong>
     </p>
     <ol>
      <li>
       <code>
        2 &lt;= A.length &lt;= 50000
       </code>
      </li>
      <li>
       <code>
        0 &lt;= A[i] &lt;= 50000
       </code>
      </li>
     </ol>
    </div>
   </div>
   <div>
    <div>
     &nbsp;
    </div>
   </div>
  </div>
  <div>
   <h1 class="question_title">
    1002. 最大宽度坡
   </h1>
   <p>
    给定一个整数数组&nbsp;
    <code>
     A
    </code>
    ，
    <em>
     坡
    </em>
    是元组&nbsp;
    <code>
     (i, j)
    </code>
    ，其中&nbsp;&nbsp;
    <code>
     i &lt; j
    </code>
    &nbsp;且&nbsp;
    <code>
     A[i] &lt;= A[j]
    </code>
    。这样的坡的宽度为&nbsp;
    <code>
     j - i
    </code>
    。
   </p>
   <p>
    找出&nbsp;
    <code>
     A
    </code>
    &nbsp;中的坡的最大宽度，如果不存在，返回 0 。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     示例 1：
    </strong>
   </p>
   <pre><strong>输入：</strong>[6,0,8,2,1,5]
<strong>输出：</strong>4
<strong>解释：</strong>
最大宽度的坡为 (i, j) = (1, 5): A[1] = 0 且 A[5] = 5.
</pre>
   <p>
    <strong>
     示例 2：
    </strong>
   </p>
   <pre><strong>输入：</strong>[9,8,1,0,1,9,4,0,4,1]
<strong>输出：</strong>7
<strong>解释：</strong>
最大宽度的坡为 (i, j) = (2, 9): A[2] = 1 且 A[9] = 1.
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     提示：
    </strong>
   </p>
   <ol>
    <li>
     <code>
      2 &lt;= A.length &lt;= 50000
     </code>
    </li>
    <li>
     <code>
      0 &lt;= A[i] &lt;= 50000
     </code>
    </li>
   </ol>
   <p>
    &nbsp;
   </p>
  </div>
 </body>
</html>